package com.liuyingxing.javaSpringCloudTest.controller;

import com.liuyingxing.entity.test.Country;
import com.liuyingxing.javaSpringCloudTest.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 * @File CountryController.java
 * @Auth liuxing
 * @Date 2021/8/19 15:30
 * @Email liuxing997@foxmail.com
 */
@RestController
@RequestMapping("/api/test")
public class CountryController {

    @Autowired
    private CountryService countryService;

     /**
     * 根据国家ID查询国家信息
     * 127.0.0.1/api/test/country/522 ---- get
     */
    @GetMapping("/country/{countryId}")
    public Country getCountryByCountryId(@PathVariable int countryId) {
        return countryService.getCountryByCountryId(countryId);
    }
}
